package com.ruoyi.project.Inspectionfee.controller;

import com.ruoyi.common.utils.poi.ExcelUtil;
import com.ruoyi.framework.aspectj.lang.annotation.Log;
import com.ruoyi.framework.aspectj.lang.enums.BusinessType;
import com.ruoyi.framework.web.controller.BaseController;
import com.ruoyi.framework.web.domain.AjaxResult;
import com.ruoyi.framework.web.page.TableDataInfo;
import com.ruoyi.project.Inspectionfee.damin.Inspectionfee;
import com.ruoyi.project.Inspectionfee.service.InspectionfeeSerivce;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.web.bind.annotation.*;

import java.util.List;

@RestController
@RequestMapping("system/Inspectionfee")
public class InspectionfeeController extends BaseController {
    @Autowired
    private InspectionfeeSerivce inspectionfeeSerivce;

    /**
     * 页面数据显示
     * @param inspectionfee
     * @return
     */
    @PreAuthorize("@ss.hasPermi('system:Inspectionfee:list')")
    @RequestMapping("/list")
    public TableDataInfo list(Inspectionfee inspectionfee){
        startPage();
        List<Inspectionfee> list = inspectionfeeSerivce.selectInspectionfeelist(inspectionfee);
        return getDataTable(list);
    }
    /**
     *数据回显
     * @param inspectionfeeId
     * @return
     */
    @PreAuthorize("@ss.hasPermi('system:inspectionfee:query')")
    @GetMapping(value = "/{inspectionfeeId}")
    public AjaxResult geInfo(@PathVariable("inspectionfeeId") Long inspectionfeeId){
        return AjaxResult.success(inspectionfeeSerivce.selectInspectionfeeById(inspectionfeeId));
    }
    /**
     * 数据修改
     * @param inspectionfee
     * @return
     */
    @PreAuthorize("@ss.hasPermi('system:inspectionfee:edit')")
    @Log(title = "【请填写功能名称】", businessType = BusinessType.UPDATE)
    @PutMapping
    public AjaxResult edit(@RequestBody Inspectionfee inspectionfee){
        return toAjax(inspectionfeeSerivce.updateInspectionfee(inspectionfee));
    }

    /**
     * 删除
     * @param inspectionfeeIds
     * @return
     */
    @PreAuthorize("@ss.hasPermi('system:inspectionfee:remove')")
    @Log(title = "【请填写功能名称】", businessType = BusinessType.DELETE)
    @DeleteMapping("/{inspectionfeeIds}")
    public AjaxResult remove(@PathVariable Long[] inspectionfeeIds){
        return toAjax(inspectionfeeSerivce.deleteInspectionfeeByIds(inspectionfeeIds));
    }

    /**
     * 新增
     * @param inspectionfee
     * @return
     */
    @PreAuthorize("@ss.hasPermi('system:inspectionfee:add')")
    @Log(title = "【请填写功能名称】", businessType = BusinessType.INSERT)
    @PostMapping
    public AjaxResult add(@RequestBody Inspectionfee inspectionfee){
        return AjaxResult.success(inspectionfeeSerivce.insertInspectionfee(inspectionfee));
    }
    /**
     * 导出【请填写功能名称】列表
     */
    @PreAuthorize("@ss.hasPermi('system:inspectionfee:export')")
    @Log(title = "【请填写功能名称】", businessType = BusinessType.EXPORT)
    @GetMapping("/export")
    public AjaxResult export(Inspectionfee inspectionfee)
    {
        List<Inspectionfee> list = inspectionfeeSerivce.selectInspectionfeelist(inspectionfee);
        ExcelUtil<Inspectionfee> util = new ExcelUtil<Inspectionfee>(Inspectionfee.class);
        return util.exportExcel(list, "inspectionfee");
    }
}
